let jwt = require('jsonwebtoken');
const { database } = require('./tools/config');
let uuid = require('uuid');
let secret = 'wdnmd';

//jwt的组成
//1、header（头）：{alg:"hs256",typ:"jwt"}
//2、payload（载体）：{username:"zhangsan",exp:失效时间}
//3、signature（签名）：由header+payload+secret 使用hs256算法加密再转base64


//生成jwt字符串
let token = jwt.sign({exp:Date.now()+1000*60*60*24*30,username:'jack'},secret);
// console.log(token);
//验证token是否正确
// console.log(jwt.verify(token,secret));

uuid.v1();